<template>
	<view class="uni-float-btn">
		<view :class="{ 'btn-mark': showBtnList }" cathctouchmove @tap="hideBtnModal"></view>
		<button class="cu-btn wechat-btn" @tap="onBtn">
			<uni-icons v-if="!showBtnList" class="wechat_img" type="more-filled" size="50" color="#fff"></uni-icons>
			<uni-icons v-else class="wechat_img" type="closeempty" size="50" color="#fff"></uni-icons>
		</button>
		<view>
			<button class="cu-btn my_btn" @tap="navigateTo('/pagesA/order/ticketOrder')">
				<view class="btn-name">门票</view>
				<!--<uni-icons class="wechat_img" type="person-filled" size="50" color="#fff"></uni-icons>-->
			</button>
			<!--<view class="btn-name">门票</view>-->
		</view>
		<view :class="showBtnList ? 'float--active' : 'float-list-box'">
			<view class="btn-item" @tap="exChange">
				<img src="../../static/image/icon/kaipiaozhushou.png" alt="" class="img">
				<view class="btn-name">领券</view>
			</view>
			<view class="btn-img-box y-f" @tap="onBtnItem()">
				<view class="btn-item">
					<uni-icons class="btn-img" type="phone-filled" size="44" color="#fff"></uni-icons>
					<view class="btn-name">紧急</view>
				</view>
			</view>
		</view>

		<uni-login-model></uni-login-model>
	</view>
</template>
<script>
    import uniIcons from '../uni-icons/uni-icons.vue'
    import uniIconfont from '../uni-iconfont/index'
    import uniLoginModel from '../uni-login-model/uni-login-model.vue'
    import { mapState } from 'vuex'

	export default {
		components: {
            uniIcons, uniIconfont, uniLoginModel
		},
		data() {
			return {
                showBtnList: false,
			}
		},
        computed: {
            ...mapState({
                userInfo: state => state.user.userInfo
            })
        },
        created() {
        },
        methods: {
            onBtnItem() {
                /*uni.navigateTo({
                    url: '/pagesA/emergency/emergency'
                })*/
                this.$wx.miniProgram.reLaunch({
                    url: `/pages/getLocation/getLocation?phone=${this.userInfo.phone}&name=${this.userInfo.nickName}`,
                    success: function(){
                        console.log('success')
                    },
                    fail: function(err){
                    },
                    complete:function(){
                        console.log('complete');
                    }
                });
                this.showBtnList = false;
            },
            exChange() {
                uni.navigateTo({
                    url: '/pagesA/emergency/exchange'
                })
                this.showBtnList = false;
            },
            onBtn() {
                this.showBtnList = !this.showBtnList;
            },
            navigateTo(url) {
                uni.navigateTo({
                    url: url
                })
			},
            hideBtnModal() {
                this.showBtnList = false;
            },
        }
	}
</script>
<style lang="scss" scoped>
	.btn-mark {
		z-index: -1;
		position: fixed;
		width: 100%;
		height: 100%;
		left: 50%;
		top: 50%;
		transform: translate(-50%, -50%);
		background: rgba(#000, 0.4);
	}
	.uni-float-btn {
		position: fixed;
		bottom: 200rpx;
		right: 30rpx;
		z-index: 888;
		width: 10%;
		.float--active {
			position: absolute;
			bottom: 100%;
			left: 0;
			transform: scale(1);
			transition: all 0.2s linear;
		}
		.float-list-box {
			position: absolute;
			bottom: 0;
			left: 0;
			transform: scale(0);
			transform-origin: bottom;
			opacity: 0;
			transition: all 0.2s linear;
		}
		/*y竖直居中*/
		.y-f {
			display: flex;
			flex-direction: column;
			align-items: center;
		}
		.btn-img-box {
			text-align: center;
		}
		.btn-name {
			font-size: 28rpx;
			color: #fff;
			text-align: center;
			white-space: nowrap;
		}
		.btn-item {
			margin-bottom: 20rpx;
			.btn-img {
				width: 80rpx;
				height: 80rpx;
				background: #FC544A;
				border-radius: 50%;
				padding: 16rpx;
			}
			.img {
				width: 80rpx;
				height: 80rpx;
			}
		}
		.my_btn {
			border-radius: 50%;
			/*border: 6rpx solid #fff;*/
			width: 80rpx;
			height: 80rpx;
			margin-top: 20rpx;
			background: #6CB041;
		}
		.wechat-btn {
			border-radius: 50%;
			background: none;
			padding: 0;
			font-size: 34rpx;
			width: 80rpx;
			height: 80rpx;
			background: #FC544A;
			/*border: 6rpx solid #fff;*/
			.wechat_img {
				width: 80rpx;
				height: 60rpx;
				line-height: 62rpx;
			}
		}
	}
</style>